/
PersistedAuthCookie.cs
54 lines (46 loc) · 1.75 KB
/
PersistedAuthCookie.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
// ReSharper disable MemberCanBePrivate.Global
namespace DotNetNuke.Security.Cookies
{
using System;
using System.Data;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Modules;
[Serializable]
[TableName("AuthCookies")]
[PrimaryKey("CookieId")]
public class PersistedAuthCookie : IHydratable
{
public int CookieId { get; private set; }
public string CookieValue { get; private set; }
public DateTime ExpiresOn { get; private set; } // UTC
/// <inheritdoc/>
public int KeyID
{
get { return this.CookieId; }
set { this.CookieId = value; }
}
/// <inheritdoc/>
public void Fill(IDataReader dr)
{
this.CookieId = Null.SetNullInteger(dr[nameof(this.CookieId)]);
this.CookieValue = Null.SetNullString(dr[nameof(this.CookieValue)]);
this.ExpiresOn = Null.SetNullDateTime(dr[nameof(this.ExpiresOn)]);
if (this.ExpiresOn.Kind != DateTimeKind.Utc)
{
this.ExpiresOn = new DateTime(
this.ExpiresOn.Year,
this.ExpiresOn.Month,
this.ExpiresOn.Day,
this.ExpiresOn.Hour,
this.ExpiresOn.Minute,
this.ExpiresOn.Second,
this.ExpiresOn.Millisecond,
DateTimeKind.Utc);
}
}
}
}